package com.abbas.smartCity.retroft

import android.widget.Toast
import com.abbas.CayTcore.CoreApp
import com.abbas.CayTcore.entity.NetBean

class RetrofitCallback2Dsl<T> {

    var onSuccess: ((NetBean<T>) -> Unit)? = null
    var onNetError: (() -> Unit) = {
        CoreApp.handler.post {
            Toast.makeText(CoreApp.context, "网络出现问题，请检查网络", Toast.LENGTH_SHORT).show()
        }
    }
    var onRequestError: ((msg: String) -> Unit)? = null

    fun onSuccess(block: (NetBean<T>) -> Unit) {
        this.onSuccess = block
    }

    fun onRequestError(block: (msg:String) -> Unit){
        this.onRequestError = block
    }

}